
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
boolean isMatch=false;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<link type="text/css" rel="stylesheet" href="<%=basePath%>statics/js/plug/jbox/jBox.css"/>
<link type="text/css" rel="stylesheet" href="<%=basePath%>statics/js/plug/jedate/skin/jedate.css"/>
<script type="text/javascript" src="<%=basePath %>statics/js/plug/jedate/jquery.jedate.js"></script>
<script type="text/javascript" src="<%=basePath %>statics/js/plug/jquery.validate.js"></script>
<script type="text/javascript" src="<%=basePath%>statics/js/plug/jbox/jBox.js"></script>
<script type="text/javascript">
    var oldUserName = '${user.userName}';
</script>
<script type="text/javascript" src="<%=basePath%>statics/js/plug/selectator-master/fm.selectator.jquery.js"></script>
<script type="text/javascript" src="<%=basePath%>statics/js/base/baseuser/base_user_edit.js"></script>
<div class="window-title-bar">
    <h5 class="title">修改用户</h5>
</div>
<form id="updateForm">
	
	<table>
		<tr>
			<td class="attr"><span>用 户 名：</span>
			<input id="updateaecId" name="id" type="hidden" value="${user.id}"></td>
			<td><input id="updateUserName" type="text" name="userName" value="${user.userName}"  placeholder="4~20位英文和数字的组合"></td>
		</tr>
		<tr>
			<td class="attr"><span>密&nbsp&nbsp码：</span></td>
			<td><input id='updatePassword' type="password" name='password'
				type='text' value="${user.password}" style="width: 325px;height: 25px "></td>
		</tr>
		<tr>
			<td class="attr"><span>别&nbsp&nbsp名：</span></td>
			<td><input id='updateNickname' name='nickname' type='text' value="${user.nickname}"></td>
		</tr>
		<tr>
			<td class="attr"><span>所属角色：</span></td>
			<td><select id="updateRole" style="width: 325px" name="roleId" multiple class="selectator" data-selectator-keep-open="true" data-selectator-show-all-options-on-focus="true">
			<c:forEach var="item" items="${role}" varStatus="status">
						<option value="${item.id}" selected="selected">${item.roleName}</option>
					</c:forEach>
					<c:forEach var="item" items="${roleList}" varStatus="status">
					<%isMatch=false; %>
					<c:if test="${empty role}">
						<option value="${item.id}" >${item.name}</option>
					</c:if>
					<c:forEach var="role" items="${role}" varStatus="status">
					<c:if test="${role.id==item.id}">
						<%isMatch=true; %>
					</c:if>
					</c:forEach>
					<c:if test="<%=!isMatch%>">
						<option value="${item.id}" >${item.name}</option>
					</c:if>
					</c:forEach>
			</select>
				
			</td>
		</tr>
		<tr>
			<td class="attr"><span>所属部门：</span></td>
			<td><select id="updateDepartment" name="departmentId" style="width: 325px;height: 25px">
					<option>${dept.name}</option>
				</select>
				<input type="hidden" id="updateDepartmentTemp" value="${user.departmentId}"/>
			</td>
		</tr>
  			<input class="radio" id="status" type="hidden" name="status" value="1" checked="checked">
		<tr>
			<td class="attr"><span>性&nbsp&nbsp别：</span></td>
			<td><input class="radio" id='updateSex1' name='sex'
				type='radio' value="1"  ${user.sex == 1 ? "checked" : ""}><span>男</span>
				&nbsp;&nbsp;&nbsp;&nbsp;<input class="radio" id='updateSex2'
				name='sex' type='radio' value="0" ${user.sex == 0 ? "checked" : ""}><span>女</span></td>
		</tr>
		<tr>
			<td class="attr"><span>刷新缓存：</span></td>
			<td>
				<input class="radio" name='isRefreshCache' type='radio' checked="checked" value="0"><span>不刷新</span>
				<input class="radio" name='isRefreshCache' type='radio' value="1"><span>刷新</span>&nbsp;&nbsp;&nbsp;&nbsp;
			</td>
		</tr>
		 <tr>
            <td class="attr"><span>出生日期：</span></td>
            <td><input id="updateBirthday" class="datainp wicon" type="text" readonly value="<fmt:formatDate  pattern="yyyy-MM-dd" value="${user.birthday}" />" name="birthday" onclick="$.jeDate('#updateBirthday',{ skinCell:'jedateblue',insTrigger:false,format:'YYYY-MM-DD',isTime:false})"></td>
        </tr>
		<%-- <tr>
            <td class="attr"><span>问题：</span></td>
            <td><input id="question" type="text" name="question" value="${user.question}"></td>
        </tr>
        <tr>
            <td class="attr"><span>答案：</span></td>
            <td><input id="answer" type="text" name="answer" value="${user.answer}"></td>
        </tr> --%>
        <tr>
            <td class="attr"><span>职务：</span></td>
            <td><input id="post" type="text" name="post" value="${user.post }"></td>
        </tr>
        <tr>
            <td class="attr"><span>电话：</span></td>
            <td><input id="telephone" type="text" name="telephone"><span id='telephoneSpan' style='color:red'></span></td>
        </tr>
          <tr>
            <td class="attr"><span>邮件：</span></td>
            <td><input id="eamil" type="text" name="email" value="${user.email }"></td>
        </tr>
        <tr>
            <td class="attr"><span>住址：</span></td>
            <td><input id="address" type="text" name="address" value="${user.address }"></td>
        </tr>
      	<tr>
			<td class="attr"><span>备&nbsp&nbsp注：</span></td>
			<td><input id="updateRemark" type="text" name="remark" value="${user.remark}"></td>
		</tr>
        
	</table>
	<div class="buttons">
        <button type="submit" class="green">更新</button>
        <button id="cancleBtn" type="button" class="red">取消</button>
    </div>
</form>